﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AlgoImpl;
using ApplLogic.ApplClasses;

namespace ApplLogic.ApplToAlgoConvertor
{
    public class ApplAlgoObjectConvertor
    {

        # region ApplObjectToAlgoObject
        public static Worker CreateAlgoWrokerFromAppl(ApplWorker applWorker)
        {
            Worker algoWorker = new Worker();
            algoWorker.Id = applWorker.PersonalDetails.Id;
            algoWorker.Name = applWorker.PersonalDetails.FirstName;
            algoWorker.MaxShiftsThatCanGive = applWorker.MaxShiftsThatCanGive;

            return algoWorker;
        }

        public static eResult CreateApplResultFromAlgoResult(eStepThatGotShift stepGotShiftByAlgo)
        {
            eResult applResult = eResult.NONE;
            switch (stepGotShiftByAlgo)
            {
                case eStepThatGotShift.FIRST:
                    applResult = eResult.FIRST;
                    break;
                case eStepThatGotShift.SECOND:
                    applResult = eResult.SECOND;
                    break;
                case eStepThatGotShift.THIRD:
                    applResult = eResult.THIRD;
                    break;
                default:
                    break;             
            }

            return applResult;
        }


        public static Shift CreateAlgoShiftFromApplShift(ApplShift applShift)
        {
            Shift algoShift = new Shift(applShift.Name, applShift.NumberOfWorkersNeeded);
            algoShift.Id = applShift.Id;

            return algoShift;
        }
        #endregion
    }
}
